import Vue from 'vue'
import Router from 'vue-router'

// import Home from '@/views/Home/index'
// import childHome from '@/views/Home/childHome'
// import childHomeposts from '@/views/Home/childHomeposts'

Vue.use(Router)

const router = new Router({
	routes: [{
			path: '/',
			redirect: '/index',
		},
		{
			path: '/index',
			component: () => import('@/views/Home/index'),
			meta: {
				title: '首页'
			},
			children: [{
					path: '',
					component: () => import('@/views/Home/childHome'), //默认路由
				},
				{
					name: 'childHome',
					path: 'childHome',
					component: () => import('@/views/Home/childHome'),
					meta: {
						title: '测试'
					},
				},
				{
					name: 'childHomeposts',
					path: 'childHomeposts',
					component: () => import('@/views/Home/childHomeposts'),
					meta: {
						title: '测试'
					},
				}
			]
		},
		{
			path: '/Login',
			component: () => import('@/views/Login/index'),
			meta: {
				title: '登录'
			},
		},
		{
			path: '*', //必须在routes数组最后一个才能生效
			component: () => import('@/views/Error-page/404'),
		},
	],
	//滚动行为
	scrollBehavior: () => ({
		x: 0,
		y: 0
	}),
})

export default router
